package com.speed.printer;


import java.io.InputStream;  
import java.util.ArrayList;  
import java.util.Date;  
import java.util.HashMap;  
import java.util.List;  
import java.util.Map;

import com.speed.vo.ActiviterVO;

  
public class LPrinter {  
    public static void export() throws Exception{  
          
        InputStream inputStream = LPrinter.class.getResourceAsStream("report1.jasper");  
        Map<String, Object> parameters = new HashMap<String,Object>();  
          
        List<ActiviterVO> activiterVOs = new ArrayList<ActiviterVO>();  
        activiterVOs.add(new ActiviterVO("程畅","15838163869","88888888"));  
        //activiterVOs.add(new User("user_02",new Date()));  
       
//        JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(activiterVOs);  
//        JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, parameters, dataSource);  
          
//          
//        JRTextExporter exporter = new JRTextExporter();  
//          
//        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);    
//        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "javabean.txt");    
//        exporter.setParameter(JRTextExporterParameter.PAGE_WIDTH, 200);    
//        exporter.setParameter(JRTextExporterParameter.PAGE_HEIGHT, 100);    
//        exporter.exportReport();  
        
        
//        JRPdfExporter exporter = new JRPdfExporter();  
//        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
//        //exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, response.getOutputStream());
//        exporter.setParameter(JRTextExporterParameter.PAGE_WIDTH, 1);    
//        exporter.setParameter(JRTextExporterParameter.PAGE_HEIGHT, 1);
//        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "javabean.pdf");
        //response.setHeader("Content-Disposition", "attachment;filename=first.pdf");
        //response.setContentType("application/pdf");
        //response.setCharacterEncoding("UTF-8");  
       // exporter.exportReport();
    }  
      
    public static void main(String[] args) throws Exception {  
        export();  
    }  
}  

